{template 'common/header'}
<title>装修需求提交</title>
<style type="text/css">
    *{margin:auto;}
    body {margin:0; font-family:'微软雅黑'; background:#EFEFEF;}
    a:link,a:visited,a:active{color:#fff;text-decoration:none;}
    a:hover{color:#fff;text-decoration:none;}
    .main{width:80%;height:220px;}
    .liuchengtu{width:90%;height:300px;margin-top:10px;}
    .liuchengtu img{width:100%;height:100%;}
    .neirong{width:100%;height:190px;}
    .submit{width:80%;height:30px;background:#FDB63E;color:#fff;text-align:center;line-height:30px;}
    .line{width:100%;height:30px;border-bottom:1px dashed #DDDDDD;font-size:14px;}
    .line .title{height:25px;float:left;line-height:30px;color:#707070;}
    .line .inner{height:25px;float:left;}
    .line input {float:left; height:25px; padding:0px; margin:0px; border:0px; outline:none; font-size:16px; color:#707070;background:#EFEFEF;}
</style>
<div id='container'></div>
<div class="main">
    <div class="neirong">
        <div class="line"><div class="title">您的姓名：</div><div class="inner"><input type="text" id="name"/></div></div>
        <div class="line"><div class="title">您的号码：</div><div class="inner"><input type="text" id="mobile"/></div></div>
        <div class="line"><div class="title">所在城市：</div><div class="inner"><input type="text" id="city"/></div></div>
        <div class="line"><div class="title">店铺面积：</div><div class="inner"><input type="text" id="square"/></div></div>
        <div class="line"><div class="title">装修预算：</div><div class="inner"><input type="text" id="price"/></div></div>
        <div class="line"><div class="title">装修时间：</div><div class="inner"><input type="text" id="starttime"/></div></div>
    </div>
    <div class="submit" id="submit">提交</div>
</div>
<div class="liuchengtu"><img src="../addons/ewei_shop/template/mobile/default/static/images/jiameng/liuchengtu.png"></div>
<script language="javascript">
    require(['tpl', 'core'], function(tpl, core) {   
                            $('#submit').click(function(){
                               if($(this).attr('saving')=='1'){
                                   return;
                               }
                                $(this).html('正在处理...').attr('saving',1);
                                if($('#name').isEmpty()){
                                    core.tip.show('请输入您的姓名!');
                                    return;
                                }
                                if($('#mobile').isEmpty()){
                                    core.tip.show('请输入电话号码!');
                                    return;
                                }
                                var mobile=$('#mobile').val();
                                if(isNaN(mobile)){
                                    core.tip.show('请正确输入电话号码！');
                                    return;  
                                }
                                if($('#city').isEmpty()){
                                    core.tip.show('请输入所在城市!');
                                    return;
                                }
                                if($('#square').isEmpty()){
                                    core.tip.show('请输入店铺面积!');
                                    return;
                                }
                                var square=$('#square').val();
                                if(isNaN(square)){
                                    core.tip.show('店铺面积，请输入数字类型！');
                                    return;  
                                }
                                if(square < 0){
                                    core.tip.show('店铺面积，请输入大于0的数字!');
                                    return;
                                }
                                if($('#price').isEmpty()){
                                    core.tip.show('请输入装修预算!');
                                    return;
                                }
                                var price=$('#price').val();
                                if(isNaN(price)){
                                    core.tip.show('装修预算，请输入数字类型！');
                                    return;  
                                }
                                if(price < 0){
                                    core.tip.show('装修预算，请输入大于0的数字!');
                                    return;
                                }
                                if($('#starttime').isEmpty()){
                                    core.tip.show('请输入装修时间!');
                                    return;
                                }
                                var data = {
                                        name: $('#name').val(),
                                        mobile: $('#mobile').val(),
                                        city: $('#city').val(),
                                        square: $('#square').val(),
                                        price: $('#price').val(),
                                        starttime: $('#starttime').val()
                                }
                                core.json('franchise/center',{
                                    op:'decorate_need',
                                    id:"{$_GPC['id']}",
                                    data:data
                                 },function(postjson){
                                     if(postjson.status==1){
                                        alert("提交成功！");
                                        $("#submit").html('提交').removeAttr('saving');
                                     }else{
                                         core.tip.show('操作失败'); 
                                         $("#submit").html('提交').removeAttr('saving');
                                     }
                                },true,true);
                           }); 
    });
</script>
{template 'common/footer'}